package org.apache.myfaces.custom.ysf.command;

import java.io.IOException;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;

import org.apache.myfaces.component.html.ext.HtmlCommandLink;
import org.apache.myfaces.renderkit.html.ext.HtmlLinkRenderer;

public class CommandLinkRenderer extends HtmlLinkRenderer {

	@Override
	 public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
    		throws IOException {
		HtmlCommandLink hcl = (HtmlCommandLink)uiComponent;
		
		if ( hcl.isDisabled() ) {			
			hcl.setOnclick(null);
			hcl.getAttributes().put("onclick", "");
		}
		super.encodeBegin(facesContext, uiComponent);
	}
}
